package com.bm.mapper;

import com.bm.pojo.Word;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface WordMapper {
    @Insert("INSERT INTO words (english_word,chinese_word,chapter) VALUES (#{englishWord}, #{chineseWord},#{chapter})")
    void insertWord(Word word);

    @Select("select * from words")
    @Results({
            @Result(property = "id", column = "id", id = true),
            @Result(property = "englishWord", column = "english_word"),
            @Result(property = "chineseWord", column = "chinese_word"),
            @Result(property = "chapter", column = "chapter")
    })
    //@ResultMap("myWordResultMap")
    List<Word> selectWords();

    @Select("select * from words where id = #{id}")
    Word selectWordById(Integer id);
}
